import configUrl from "@/utils/config.js"
export const JerryRequest = (config) => {
	uni.showLoading({
		title: '加载中...',
		mask:true
	})
	return new Promise((resolve, reject) => {
		uni.request({
			url: configUrl.baseUrl + config.url,
			method: config.method || 'GET',
			data: config.data || {},
			header: {
				'X-Requested-With': 'XMLHttpRequest',
				"Accept": "application/json",
				"Content-Type": config.contentType || "application/json; charset=UTF-8",
				'satoken': config.satoken || ''
			},
			success(res) {
				uni.hideLoading()
				resolve(res)
			},
			fail(erro) {
				uni.hideLoading()
				uni.showToast({
						title: "请求失败"
					}),
					reject(erro)
			}
		})
	})
}